package com.atguigu.paymentdemo.controller;

import com.atguigu.paymentdemo.service.AliPayService;
import com.atguigu.paymentdemo.service.OrderInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

@CrossOrigin
@RestController

@Api(tags = "变现猫")
@Slf4j
public class CatController {

    @Resource
    private AliPayService aliPayService;

    @Resource
    private Environment config;

    @Resource
    private OrderInfoService orderInfoService;
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @ApiOperation("变现猫访问数据登记")
    @GetMapping("/cat")
    public void catIn(@RequestParam String bxm_id){

        Long startTime = System.currentTimeMillis();
        log.info("saveCatIn id,开始时间 ===> {},{}", bxm_id,df.format(new Date()));


        aliPayService.saveCatIn(bxm_id);
//        aliPayService.saveCatOut(bxm_id,"13570269811");

        log.info("保存成功,cost time:{}ms",System.currentTimeMillis()-startTime);
    }


}
